import axios from '@/libs/api.request'

export const getBrandByCondition = (condition) => {
  return axios.request({
    url:   'brands',
		params: condition,
    method: 'get'
  })
}

export const getBrandsByCid = (cid) => {
  return axios.request({
    url:   'brands/select',
		params: {'cid':cid},
    method: 'get'
  })
}

export const getBrandById = (id) => {
  return axios.request({
    url:   'brands/'+id,
    method: 'get'
  })
}

export const addBrand = (brand) => {
  return axios.request({
    url:   'brands',
    data: brand,
    method: 'post'
  })
}

export const updateBrand = (brand) => {
  return axios.request({
    url:   'brands/'+brand.id,
    data: brand,
    method: 'put'
  })
}

export const deleteBrandByIds = (ids) => {
  return axios.request({
    url:   'brands',
		params: ids,
    method: 'delete'
  })
}